/*
 * CS_FIGHT_END_WITH_BOT.cpp
 *
 *  Created on: 2013. 9. 27.
 *      Author: mega@gamevil.com
 */

#include "../../Command.h"

#include "../../User.h"
#include "../../NLogic/Space.h"

namespace ProjectZ { namespace NCommand {

void Command::CS_FIGHT_END_WITH_BOT(User * pUser, ::Network::Packet * pPacket)
{
	PREPARE_PACKET;

	char isWin = 0;

	*pPacket >> isWin;

	NLogic::Space *pSpace = pUser->GetSpace();

	if (NULL == pSpace)
	{
		DEBUGLOG("CS_FIGHT_END_WITH_BOT : pSpace is NULL!!!");
		return;
	}

	pSpace->GetData()._winnerGID	= -1;

	if (1 == isWin)
	{
		pSpace->GetData()._winnerGID = pUser->GetUserSeq();
	}

	::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
	pAck->MakePacket(CMD_SC_FIGHT_END_WITH_BOT);
	pUser->Send(pAck);

}

} /*NCommand*/ } /*ProjectZ*/


